# core/logger_config.py
import os
from loguru import logger

def setup_logger():
    log_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', 'logs')
    os.makedirs(log_dir, exist_ok=True)
    log_path = os.path.join(log_dir, 'game_automation.log')
    logger.remove()
    logger.add(
        log_path,
        level='INFO',
        format='{time:YYYY-MM-DD HH:mm:ss} - {level} - {message}',
        encoding='utf-8',
        rotation='100 MB',
        retention='7 days',
        enqueue=False
    )
    return log_path
